﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows;

namespace Kokomo.PeInspector
{
	public class PeModuleString
	{
		public PeModuleString(
			string str,
			long address,
			string sectionName,
			uint rva
			)
		{
			this.String = str;
			this.Address = address;
			this.SectionName = sectionName;
			this.Rva = rva;

			this.CopyTextCommand = new DelegatedCommand(this.CopyText);
		}

		public override string ToString()
		{
			return string.Format("\"{0}\"", this.String);
		}

		public ICommand CopyTextCommand { get; private set; }
		private void CopyText()
		{
			Clipboard.SetText(this.String);
		}

		public long Address { get; private set; }
		public string SectionName { get; private set; }
		public string String { get; private set; }
		public int Length
		{
			get { return (this.String == null) ? 0 : this.String.Length; }
		}
		public uint Rva { get; private set; }
	}
}
